/**
 * This class will receive the customers personal details with their yearly
 * income, yearly expense, yearly savings and find their credit rating and pass
 * it to calling object.
 * 
 * @author Ravi
 */

public class Customer {
	int customerId;
	String customerFirstName;
	String customerLastName;
	int customerAge;
	String customerOccupation;
	float customerYearlyIncome;
	float customerYearlyExpenses;
	float customerYearlySavings;
	boolean hasDepth;
	float savingPercentage;
	int creditScore;
	String creditRating;

	/**
	 * This method will print the customer personal details *
	 */
	void customerPersonalDetails() {
		System.out.println("Customer Frist & Last Name = " + customerFirstName
				+ " " + customerLastName);
		System.out.println("Customer Age               = " + customerAge);
		System.out
				.println("Customer Occupation        = " + customerOccupation);

	}

	/**
	 * This method will calculate customer yearly savings percentage based on
	 * their yearly earning and expenses *
	 */

	float savingsCalculator() {

		customerYearlySavings = customerYearlyIncome - customerYearlyExpenses;

		savingPercentage = ((customerYearlySavings / customerYearlyIncome) * 100);

		return savingPercentage;
	}

	/**
	 * This method will find the customer credit score based on their yearly
	 * savings percentage *
	 */

	int creditScoreFinder() {
		if (!hasDepth) {
			if (savingPercentage <= 5) {
				creditScore = 580;
			} else if (savingPercentage > 5 && savingPercentage <= 15) {
				creditScore = 640;
			} else if (savingPercentage > 15 && savingPercentage <= 25) {
				creditScore = 700;
			} else if (savingPercentage > 25 && savingPercentage <= 35) {
				creditScore = 750;
			} else {
				creditScore = 850;
			}
		}
		return creditScore;
	}

	/**
	 * This method will find the customer credit Rating based on their credit
	 * score *
	 */

	String creditRatingFinder() {
		if (!hasDepth) {
			switch (creditScore) {
			case (580):
				creditRating = "Very Poor";
				break;
			case (640):
				creditRating = "Poor";
				break;
			case (700):
				creditRating = "Fair";
				break;
			case (750):
				creditRating = "good";
				break;
			default:
				creditRating = "Excelent";
				break;
			}

		} else {
			creditRating = "Wrost";
		}
		return creditRating;
	}

}
